
R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-conda-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Script to run QAP
> library(sna)
Loading required package: statnet.common

Attaching package: 'statnet.common'

The following objects are masked from 'package:base':

    attr, order

Loading required package: network

'network' 1.18.1 (2023-01-24), part of the Statnet Project
* 'news(package="network")' for changes since last version
* 'citation("network")' for citation information
* 'https://statnet.org' for help, support, and other information

sna: Tools for Social Network Analysis
Version 2.7-1 created on 2023-01-24.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
 For citation information, type citation("sna").
 Type help(package="sna") to get started.

Warning messages:
1: package 'sna' was built under R version 4.2.3 
2: package 'statnet.common' was built under R version 4.2.3 
3: package 'network' was built under R version 4.2.3 
> library(doParallel)
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
> library(doRNG)
Loading required package: rngtools
> library(fastglm)
Loading required package: bigmemory
Warning message:
package 'bigmemory' was built under R version 4.2.3 
> 
> source("fast_qap.R")
> 
> # Load the followers adjacency matrix
> y <- readRDS("processed_data/followers_adjacencyMatrix.Rds")
> # Load the predicting matrices
> load("processed_data/QAP_predicting_matrices.RData")
> # load simulated edgelists
> load("simulated_follower_networks.RData")
> 
> # Parallel implementation to run QAP
> cl <- makeCluster(3)
> registerDoParallel(cl)
> set.seed(10)
> system.time(qap_res <- foreach(i=1:3,.packages=c("sna", "doRNG","fastglm")) %dorng% {
+   ys <- y
+   ys[,] <- 0
+   ys[as.matrix(sim_els[[i]])] <- 1
+   qap_sim <- netlogit_big(ys, predicting_matrices, reps = 100,nullhyp="qapy")
+   save(list="qap_sim",file=paste("qap_sim_follow",i,".RData",sep=""))
+ })
     user    system   elapsed 
   16.098     3.194 31528.888 
> stopCluster(cl)
> 
> 
> 
> 
> 
> proc.time()
     user    system   elapsed 
   29.507     4.375 31545.403 
